package com.example.coffeeseller_2.model.beans;


import com.example.coffeeseller_2.model.factory.BuyState;
import com.example.coffeeseller_2.model.factory.PayState;

import java.util.List;
import java.util.Map;

import cof.ac.inter.ContainerConfig;

/**
 * Created by WH on 2018/8/7.
 * 交易记录类
 */

public class DealRecorder {
    private static DealRecorder instance;
    private BuyState buyState = BuyState.NONE;
    private Coffee coffee;
    private List<ContainerConfig> containerConfigs;
    private int cupNum = 1;
    private int formulaID;
    private String price;
    private String order;
    private int payType; //微信、支付宝
    private int payState = PayState.NONE;
    private boolean isMakeSuccess = false;
    private String errCode;
    private boolean isReportSuccess = false;
    private String reportMsg;
    private int uploadCount;
    private String customerId;
    private String payTime;
    private String createTime;
    private String bunkers;
    private String rqTempFormat;
    private String tasteRadio;//口味：多糖-50
    private Map<Integer, Float> radios;


    public static DealRecorder getInstance() {
        if (instance == null) {
            instance = new DealRecorder();
        }
        return instance;
    }

   /* public String getTasteRadio() {

        String tasteRadio = "";
        if (getDealChooseTastes() != null && getDealChooseTastes().size() > 0) {

            for (int i = 0; i < getDealChooseTastes().size(); i++) {
                DealChooseTaste dealChooseTaste = getDealChooseTastes().get(i);
                TasteInfo tasteInfo = dealChooseTaste.getTasteInfo();
                if (tasteInfo == null) {
                    tasteRadio += "," + tasteInfo.getName();
                }
                tasteRadio += "-" + dealChooseTaste.getRatio();
            }
        }
        return tasteRadio;
    }*/

    public boolean isVilid() {
        if (coffee == null || containerConfigs == null || containerConfigs.size() <= 0) {
            return false;
        }
        return true;
    }

    public void clear() {

        coffee = null;
        containerConfigs = null;
        price = null;
        cupNum = 1;
        formulaID = -1;
        order = null;
        payType = -1;
        payState = PayState.NONE;
        isMakeSuccess = false;
        isReportSuccess = false;
        errCode = null;
        reportMsg = null;
        customerId = null;
        payTime = null;
        createTime = null;
        bunkers = null;
        rqTempFormat = null;
        tasteRadio = null;
        uploadCount = 0;
        radios = null;
        buyState = BuyState.NONE;
    }

    public BuyState getBuyState() {
        return buyState;
    }

    public void setBuyState(BuyState buyState) {
        this.buyState = buyState;
    }

    public Coffee getCoffee() {
        return coffee;
    }

    public void setCoffee(Coffee coffee) {
        this.coffee = coffee;
    }

    public void setTasteRadio(String tasteRadio) {
        this.tasteRadio = tasteRadio;
    }

    public String getTasteRadio() {
        return tasteRadio;
    }

    public List<ContainerConfig> getContainerConfigs() {
        return containerConfigs;
    }

    public void setContainerConfigs(List<ContainerConfig> containerConfigs) {
        this.containerConfigs = containerConfigs;
    }

    public int getCupNum() {
        return cupNum;
    }

    public void setCupNum(int cupNum) {
        this.cupNum = cupNum;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public int getPayType() {
        return payType;
    }

    public void setPayType(int payType) {
        this.payType = payType;
    }

    public int getPayState() {
        return payState;
    }

    public void setPayState(int payState) {
        this.payState = payState;
    }

    public int getFormulaID() {
        return formulaID;
    }

    public void setFormulaID(int formulaID) {
        this.formulaID = formulaID;
    }

    public boolean isMakeSuccess() {
        return isMakeSuccess;
    }

    public void setMakeSuccess(boolean makeSuccess) {
        isMakeSuccess = makeSuccess;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public boolean getReportSuccess() {
        return isReportSuccess;
    }

    public void setReportSuccess(boolean reportSuccess) {
        isReportSuccess = reportSuccess;
    }

    public String getReportMsg() {
        return reportMsg;
    }

    public void setReportMsg(String reportMsg) {
        this.reportMsg = reportMsg;
    }

    public int getUploadCount() {
        return uploadCount;
    }

    public void setUploadCount(int uploadCount) {
        this.uploadCount = uploadCount;
    }

    public boolean isReportSuccess() {
        return isReportSuccess;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getPayTime() {
        return payTime;
    }

    public void setPayTime(String payTime) {
        this.payTime = payTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getBunkers() {
        return bunkers;
    }

    public void setBunkers(String bunkers) {
        this.bunkers = bunkers;
    }

    public String getRqTempFormat() {
        return rqTempFormat;
    }

    public void setRqTempFormat(String rqTempFormat) {
        this.rqTempFormat = rqTempFormat;
    }

    public Map<Integer, Float> getRadios() {
        return radios;
    }

    public void setRadios(Map<Integer, Float> radios) {
        this.radios = radios;
    }
}
